package dimensional.traveler.client.events;

import com.google.gwt.event.shared.GwtEvent;

public class TransitionEvent extends GwtEvent<TransitionEventHandler> {
	
	public static enum Transition {
		toWelcomeScreen, 
		toLoginScreen, 
		chooseBackground, 
		beginMission,
	}

    public static Type<TransitionEventHandler> TYPE = new Type<TransitionEventHandler>();
    
	private Transition transition;
	private String data;

    public TransitionEvent(Transition transition) {
    	this(transition, "");
    }
    
    public TransitionEvent(Transition transition, String data) {
    	this.transition = transition;
    	this.data = data;
    }
    
	public Transition getTransition() {
		return transition;
	}

    public String getData() {
		return data;
	}

	@Override
    public Type<TransitionEventHandler> getAssociatedType() {
        return TYPE;
    }

    @Override
    protected void dispatch(TransitionEventHandler handler) {
        handler.onTransition(this);
    }

}